import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testcase = "dbshop021-添加品牌"
firefox = openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)

DBshopEnterMenu2(firefox,"商品管理","商品品牌")
time.sleep(5)
# 1.点击添加品牌按钮，品牌名称“苹果”。
firefox.find_element_by_xpath('//a[contains(.,"添加品牌")]').click()
firefox.find_element_by_id("brand_name").send_keys(brand_name)
# 2.点击“保存品牌”按钮。保存成功
firefox.find_element_by_xpath('//button[contains(.,"保存品牌")]').click()
time.sleep(5)


try:
    firefox.find_element_by_xpath('//td[contains(.,"%s")]'%brand_name).is_displayed()
    writeLog("%s 测试通过"%testcase)
except:
    writeLog("%s 测试失败" % testcase)
    getPhoto(firefox)
# firefox.quit()